#ifndef _KERNEL_H_
#define _KERNEL_H_

#include <td.h>
#include <sched.h>
#include <request.h>

/*
	ASSEMBLY CODE FUNCTIONS
*/

/* Assembly function: Exits the kernel and starts executing the user task */
extern void KernelExitIRQ( td *task, req *request );
extern void KernelExitSWI( td *task, req *request );

/* Assembly function: Kernel entry point */
extern void KernelEnterIRQ();
extern void KernelEnterSWI();

extern void EnableCache();

/*
	INITIALIZATION
*/

/* First user task. */ 
void UserInit();

/* Initializes the jump table and creates the first user task */
void Initialize( sched *s );

/* Schedules the next user task to execute with the highest priority */
td* Schedule( sched *s );

/* Exits the kernel, sets the task's state to ACTIVE and starts executing the user task */
void Activate( sched *s, td *task, req *request );

/* Handles the requested system call based on the parameters passed in the request */
void Handle( sched *s, td *task, req *request );

/* Restores the state of the hardware in preparation for shutdown */
void Shutdown( sched *s );

#endif
